<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>

<head>
    <style>
        body {
            background-size:cover;
            background-image: url("/image/02.png");
        }
    </style>

    <link href='<c:url context="${pageContext.request.contextPath}" value="/h-ui/css/H-ui.min.css"/>' rel="stylesheet" type="text/css" />
    <link href='<c:url context="${pageContext.request.contextPath}" value="/h-ui/css/H-ui.login.css"/>' rel="stylesheet" type="text/css" />
    <link href='<c:url context="${pageContext.request.contextPath}" value="/h-ui/lib/icheck/icheck.css"/>' rel="stylesheet" type="text/css" />
    <link href='<c:url context="${pageContext.request.contextPath}" value="/h-ui/lib/Hui-iconfont/1.0.1/iconfont.css"/>' rel="stylesheet" type="text/css" />
    <link href='<c:url context="${pageContext.request.contextPath}" value="/easyui/themes/default/easyui.css"/>' rel="stylesheet" type="text/css" />
    <link href='<c:url context="${pageContext.request.contextPath}" value="/easyui/themes/icon.css"/>' rel="stylesheet" type="text/css" />

    <script type="text/javascript" src='<c:url value="/easyui/jquery.min.js" context="${pageContext.request.contextPath}"/>'></script>
    <script type="text/javascript" src='<c:url value="/h-ui/js/H-ui.js" context="${pageContext.request.contextPath}"/>'></script>
    <script type="text/javascript" src='<c:url value="/h-ui/lib/icheck/jquery.icheck.min.js" context="${pageContext.request.contextPath}"/>'></script>
    <script type="text/javascript" src='<c:url value="/easyui/jquery.easyui.min.js" context="${pageContext.request.contextPath}"/>'></script>
    <script type="text/javascript"
            src='<c:url value="/easyui/js/easyui-lang-zh_CN.js" context="${pageContext.request.contextPath}"/>'></script>

    <script type="text/javascript">


        $(function() {

            $("#submitBtn").click(function () {

                var data = $("#form").serialize();

                $.ajax({
                    url: "/MSOS/servlet?action=update",// 跳转到修改密码的 action
                    data: data,
                    type: "post",
                    //cache:false,
                    dataType: "json",
                    success: function (msg) {
                        if (msg.status == 200) {
                            // view("修改成功！");
                            alert("修改成功！");
                            window.location.href = "/MSOS/login";
                        } else {
                            alert(msg.msg);
                            window.location.href = "/MSOS/servlet?action=update";
                        }
                    },
                    error : function() {
                        // view("异常！");
                        alert("异常！");
                        window.location.href = "/MSOS/servlet?action=update";
                    }
                });
            });
        })
    </script>

</head>
<body>
    <div style="color: #FF0066" >
        <h1 align="center">修改密码</h1>
        <form id="form" method="post">
            <h3 align="center"><input type="text" name="name" placeholder="请输入用户名"></h3>
            <h3 align="center"><input type="text" name="password" placeholder="请输入旧密码"></h3>
            <h3 align="center"><input type="text" name="newPassword1" placeholder="请输入新密码"></h3>
            <h3 align="center"><input type="text" name="newPassword2" placeholder="重新输入新密码"></h3>
            <h3 align="center"><input type="button" id="submitBtn" class="btn btn-success radius size-L" value="修改"></h3>
        </form>
    </div>
</body>
</html>

